/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package simpledraw;

import java.awt.Graphics;
import java.awt.Point;
import java.util.Iterator;


/**
 *
 * @author renatocardoso
 */
public class LineShape extends Shapes{


    @Override
  public void draw(Graphics g)
  {
    Point point1 = null;
    Point point2 = null;
    Iterator it = getList().iterator();
    //if the list does not contain the required two points, return.
    if(getList().size()<2)
    {
      return;
    }
      point1 = (Point)it.next();
      point2 = (Point)it.next();
      g.drawLine( (int)point1.getX(),(int)point1.getY(), (int)point2.getX(), (int)point2.getY());
    //getList().clear();
  }//end of draw for Triangle
    
}
